home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2795 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  57 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: Streams              
  5. X-Nntp-Posting-Host: golden.ripco.com
  6. Message-ID: <DLnvnp.229@rci.ripco.com>
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Wed, 24 Jan 1996 01:19:01 GMT
  10. X-Ident-Sender: mambuhl
  11.  
  12. xenon@the-fix.sos.on.ca
  13. in <4e0lp3$lkf@nic.wat.hookup.net> writes:
  14.  
  15. >HI,  im having some trouble getting my program to write to streams...
  16. >ex:
  17.  
  18. Since your program appears to have no errors, and compiles and runs
  19. just fine for me with bcc or gcc, I would suggest that you re-install
  20. the compiler, making sure that you skip no steps.  Dot every i and cross
  21. every t.
  22.  
  23.  
  24. >#include <stdio.h>
  25.  
  26. >int main(void)
  27. >{
  28. >   FILE *stream;
  29. >   int i = 100;
  30. >   char c = 'C';
  31. >   float f = 1.234;
  32.  
  33. >   /* open a file for update */
  34. >   stream = fopen("DUMMY.FIL", "w+");
  35.  
  36. >   /* write some data to the file */
  37. >   fprintf(stream, "%d %c %f", i, c, f);
  38.  
  39. >   /* close the file */
  40. >   fclose(stream);
  41. >   return 0;
  42. >}
  43.  
  44.  
  45. >        This example taken out of the Borland Help library should work fine.
  46. >Yet, nothing is written to the file "dummy.fil".  although the file is
  47. >created.  I have tried running my comiler from Dos and Win95 to no
  48. >avail.  My stream problem is no just centered around the disk file
  49. >streams, but also stdout, and stderr.  Strangely though, my read() and
  50. >write() functions work just fine.
  51. >thankx
  52. >xenon@the-fix.sos.on.ca
  53.                           
  54. --
  55. * Martin Ambuhl       net: mambuhl@ripco.com
  56. * Chicago, IL (USA)    
  57.